import request from "../utils/request";

export function getProducts(page = 1, pageSize = 15, keyword = '') {
  return request.get('/products', {
    params: {page, pageSize, keyword}
  })
}

export function getProduct(id) {
  return request.get('/products/' + id);
}

export function addProduct(product) {
  return request.post('/products', product);
}

export function updateProduct(product) {
  return request.patch('/products', product);
}

export function deleteProduct(id) {
  return request.delete('/products', {
    params: {id}
  })
}
